package com.bayihouse.excel.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.bayihouse.common.ErrorCode;
import com.bayihouse.exception.BusinessException;

public class IsMarriageConverter implements Converter<Integer> {

    public Class supportJavaTypeKey()
    {
        return Integer.class;
    }


    public CellDataTypeEnum supportExcelTypeKey()
    {
        return CellDataTypeEnum.STRING;
    }

    public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
                                     GlobalConfiguration globalConfiguration)
    {
        String value = cellData.getStringValue();
        if ("已婚".equals(value))
        {
            return 1;
        }else if ("未婚".equals(value)){
            return 0;
        }else {
            return 0;
        }
    }

}
